package com.uzai.console.web.wxqsuperadmin;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.cms.base.CmsBaseInfoDto;
import com.uzai.console.dto.wxqsuperadmin.WxqSuperAdminConfigDto;
import com.uzai.console.dto.wxqsuperadmin.WxqSuperAdminDto;
import com.uzai.console.dto.wxqsuperadmin.WxqSuperAdminIdDto;
import com.uzai.console.dto.wxqsuperadmin.WxqSuperAdminQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.wxqsuperadmin.WxqSuperAdminService;
import com.uzai.console.vo.cms.base.CmsBaseInfoVo;
import com.uzai.console.vo.wxqsuperadmin.WxqSuperAdminConfigVo;
import com.uzai.console.vo.wxqsuperadmin.WxqSuperAdminVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 社群超级管理员
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "社群超级管理员",tags = "微信群|社群超级管理员")
@ApiSort(5)
@RestController
public class WxqSuperAdminController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(WxqSuperAdminController.class);

    @Autowired
    private WxqSuperAdminService wxqSuperAdminService;

    @ApiOperation(value = "分页查询社群超级管理员列表", notes = "分页查询社群超级管理员列表", response = WxqSuperAdminVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/wxqSuperAdmin/findByPage")
    public Object findWxqSuperAdminList(@RequestBody WxqSuperAdminQuery wxqSuperAdminQuery){
        return wxqSuperAdminService.findByPage(wxqSuperAdminQuery);
    }

    @SystemLogType(model = SystemModelEnum.WxqSuperAdmin, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加社群超级管理员", notes = "添加社群超级管理员")
    @ApiOperationSupport(order = 2)
    @PostMapping("/wxqSuperAdmin/add")
    public Object addWxqBlacklistPrv(@RequestBody WxqSuperAdminDto wxqSuperAdminDto){
        wxqSuperAdminService.add(wxqSuperAdminDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.WxqSuperAdmin, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "移除社群超级管理员", notes = "移除社群超级管理员")
    @ApiOperationSupport(order = 3)
    @PostMapping("/wxqSuperAdmin/deleteById")
    public Object deleteWxqSuperAdmin(@RequestBody WxqSuperAdminIdDto wxqSuperAdminIdDto){
        wxqSuperAdminService.deleteById(wxqSuperAdminIdDto);
        return true;
    }

    @ApiOperation(value = "查询社群超级管理员配置", notes = "查询社群超级管理员配置", response = WxqSuperAdminConfigVo.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/wxqSuperAdmin/findConfig")
    public Object findConfig(@RequestBody WxqSuperAdminConfigDto wxqSuperAdminConfigDto){
        return wxqSuperAdminService.findConfig(wxqSuperAdminConfigDto);
    }

    @SystemLogType(model = SystemModelEnum.CmsBase, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "保存社群超级管理员配置", notes = "保存社群超级管理员配置")
    @ApiOperationSupport(order = 5)
    @PostMapping("/wxqSuperAdmin/updateConfig")
    public Object updateConfig(@RequestBody WxqSuperAdminConfigDto wxqSuperAdminConfigDto){
        wxqSuperAdminService.updateConfig(wxqSuperAdminConfigDto);
        return true;
    }


}
